package com.jzj.mapper;

import com.jzj.pojo.Book;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface BookMapper {



    @Insert("insert into book(bookName, bookAuthor, bookPrice, bookPic, bookPublisher) values (#{bookName}, #{bookAuthor},0,0 , #{bookPublisher})")
    int addBook(Book book);

    @Delete("delete from book where bookId= #{id}")
    int delBook(int id);

    @Update("update book set bookName=#{bookName},bookAuthor=#{bookAuthor},bookPublisher=#{bookPublisher} where bookId=#{bookId} ")
    int updateBook(Book book);

    @Select("select bookId,bookName,bookAuthor,bookPublisher from book")
    List<Book> selectBook();


    @Select("select bookId,bookName,bookAuthor,bookPublisher from book where bookName=#{name}")
    List<Book> selectOneBook(String name);

    @Select("select bookId,bookName,bookAuthor,bookPublisher from book where bookId=#{id}")
    Book selectBookbyId(int id);





}
